package com.yang.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yang.domain.entity.Follow;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yang
 * @since 2022-10-22
 */
public interface FollowMapper extends BaseMapper<Follow> {

    /**
     * 根据用户id查询所有粉丝
     * @param id 用户id
     * @return 粉丝集合
     */
    List<Follow> selectAllFollow(Long id);

    /**
     * 根据用户id和粉丝id删除粉丝
     * @param userId 用户id
     * @param followUserId 粉丝id
     * @return 删除结果
     */
    boolean deleteFollow(@Param("userId") Long userId, @Param("followUserId") Long followUserId);


    /**
     * 用于判断是否关注
     * @param userId 用户id
     * @param followUserId 粉丝id
     * @return 关注结果
     */
    Integer findCount(@Param("userId") Long userId, @Param("followUserId") Long followUserId);

    /**
     * 根据id删除关注旧数据
     * @param followUserId 被关注用户id
     */
    void deleteByUserId(@Param("followUserId") long followUserId);

    void batchInsert(@Param("followUserId") long followUserId, @Param("userIds") List<Long> userIds);
}
